package load.impl;

import exception.SoiRuntimeException;
import load.AbstractBeanLoader;

/**
 * @className: DefaultBeanLoader
 * @author: ocxz1
 * @date: 2025/4/2 上午1:49
 * @Version: 1.0
 * @description: soi
 */
public class DefaultBeanLoader extends AbstractBeanLoader {

    @Override
    public Object getBean(String beanName) {
        try {
            Class<?> aClass = Class.forName(beanName);
            return aClass.getConstructor().newInstance();
        } catch (Exception e) {
            throw new SoiRuntimeException(e);
        }
    }

    @Override
    public <T> T getBean(Class<T> tClass) {
        try {
            return tClass.getConstructor().newInstance();
        } catch (Exception e) {
            throw new SoiRuntimeException(e);
        }
    }
}
